/**
 * @param {string} s
 * @param {string} t
 * @return {boolean}
 */
var isSubsequence = function(s, t) {
  if(s.length == 0) return true;
  let index = 0;
  for(let i = 0; i < t.length; i++) {
    if(t.length - i < s.length - index) return false;
    if(s[index] == t[i]) {
      index++;
    }
    if(index == s.length) return true;
  }
  return false;
};
let s = "abc", t = "ahbgdc";
console.log(isSubsequence(s, t));
s = "axc", t = "ahbgdc";
console.log(isSubsequence(s, t));
s = "", t = "";
console.log(isSubsequence(s, t));
